import React, {useEffect} from 'react';
import {useNavigate,Navigate} from "react-router-dom";

function AuthComponent(props) {
    // 如果已经登陆
    if (localStorage.getItem("token"))
        return props.children;
    else
        return <Navigate to={"/login"}></Navigate>
}

export default AuthComponent;